package com.ziqikeji.xianyan.entity.comment;

import com.ziqikeji.xianyan.common.BaseEntity;
import com.ziqikeji.xianyan.entity.user.User;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * 回复 entity
 *
 * @author liuyu
 */
@Entity
@Table(name = "reply")
public class Reply extends BaseEntity {

    /**
     * 回复时间
     */
    private Date time;
    /**
     * 回复内容
     */
    private String content;
    /**
     * 赞（数量）
     */
    private Long likeNumber;
    /**
     * 踩（数量）
     */
    private Long hateNumber;
    /**
     * 回复人
     */
    private User user;
    /**
     * 被回复评论
     */
    private Comment comment;

    @Temporal(TemporalType.DATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Long getLikeNumber() {
        return likeNumber;
    }

    public void setLikeNumber(Long likeNumber) {
        this.likeNumber = likeNumber;
    }

    public Long getHateNumber() {
        return hateNumber;
    }

    public void setHateNumber(Long hateNumber) {
        this.hateNumber = hateNumber;
    }

    @ManyToOne
    @JoinColumn(name = "user_id")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne
    @JoinColumn(name = "comment_id")
    public Comment getComment() {
        return comment;
    }

    public void setComment(Comment comment) {
        this.comment = comment;
    }
}
